#include<bits/stdc++.h>
using namespace std;
int main(void){
	int i = 0;
	stack<char>s;
	char a[10000],temp;
	while(1){
		temp = getchar();
		if(temp == '.'){
			temp = getchar();
			if(temp == '\n')break;
		}
		if(temp != '\n'){
			a[i++] = temp;
		}
	}
	a[i] = 0;
	for(i = 0;a[i];i++){
		if(a[i] == '/'&&a[i+1] == '*'&&a[i+2] == '/'){
			cout<<"NO"<<endl<<"/*-?";return 0;
		}
		if(a[i] == '['||a[i] == '('||a[i] == '{')s.push(a[i]);
		else if(a[i] == '/'&&a[i+1] == '*')s.push('.');
		else if(a[i] == ']'){
			if(s.empty()){
				cout<<"NO"<<endl<<"?-]";return 0;
			}
			if(s.top() == '[')s.pop();
			else {
				cout<<"NO"<<endl<<"?-]";return 0;
			}
		}
		else if(a[i] == ')'){
			if(s.empty()){
				cout<<"NO"<<endl<<"?-)";return 0;
			}
			if(s.top() == '(')s.pop();
			else{
				cout<<"NO"<<endl<<"?-)";return 0;
			}
		}
		else if(a[i] == '}'){
			if(s.empty()){
				cout<<"NO"<<endl<<"?-}";return 0;
			}
			if(s.top() == '{')s.pop();
			else {
				cout<<"NO"<<endl<<"?-}";return 0;
			}
		}
		else if(a[i] == '*' && a[i+1] == '/'){
			if(s.empty()){
				cout<<"NO"<<endl<<"?-*/";return 0;
			}
			if(s.top() == '.')s.pop();
			else{
				cout<<"NO"<<endl<<"?-*/";return 0;
			}
		}
	}
	if(!s.empty()){
		if(s.top() == '('){
			cout<<"NO"<<endl;cout<<"(-?";return 0;
		}
		else if(s.top() == '['){
			cout<<"NO"<<endl<<"[-?";return 0;
		}
		else if(s.top() == '{'){
			cout<<"NO"<<endl<<"{-?";return 0;
		}
		else if(s.top() == '.'){
			cout<<"NO"<<endl<<"/*-?";return 0;
		}
	}
	cout<<"YES";return 0;
} 
